home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / flex_247.zip / flex_247 / flex.skl < prev    next >
Text File  |  1994-08-03  |  28KB  |  1,226 lines

  1. /* A lexical scanner generated by flex */
  2.  
  3. /* Scanner skeleton version:
  4.  * $Header: /home/daffy/u0/vern/flex/flex-2.4.7/RCS/flex.skl,v 1.2 94/08/03 11:13:24 vern Exp $
  5.  */
  6.  
  7. #define FLEX_SCANNER
  8.  
  9. %-
  10. #include <stdio.h>
  11. %*
  12.  
  13.  
  14. /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
  15. #ifdef c_plusplus
  16. #ifndef __cplusplus
  17. #define __cplusplus
  18. #endif
  19. #endif
  20.  
  21.  
  22. #ifdef __cplusplus
  23.  
  24. #include <stdlib.h>
  25. %+
  26. class istream;
  27. %*
  28. #include <unistd.h>
  29.  
  30. /* Use prototypes in function declarations. */
  31. #define YY_USE_PROTOS
  32.  
  33. /* The "const" storage-class-modifier is valid. */
  34. #define YY_USE_CONST
  35.  
  36. #else    /* ! __cplusplus */
  37.  
  38. #ifdef __STDC__
  39.  
  40. #define YY_USE_PROTOS
  41. #define YY_USE_CONST
  42.  
  43. #endif    /* __STDC__ */
  44. #endif    /* ! __cplusplus */
  45.  
  46.  
  47. #ifdef __TURBOC__
  48. #define YY_USE_CONST
  49. #endif
  50.  
  51.  
  52. #ifndef YY_USE_CONST
  53. #ifndef const
  54. #define const
  55. #endif
  56. #endif
  57.  
  58.  
  59. #ifdef YY_USE_PROTOS
  60. #define YY_PROTO(proto) proto
  61. #else
  62. #define YY_PROTO(proto) ()
  63. #endif
  64.  
  65. /* Returned upon end-of-file. */
  66. #define YY_NULL 0
  67.  
  68. /* Promotes a possibly negative, possibly signed char to an unsigned
  69.  * integer for use as an array index.  If the signed char is negative,
  70.  * we want to instead treat it as an 8-bit unsigned char, hence the
  71.  * double cast.
  72.  */
  73. #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
  74.  
  75. /* Enter a start condition.  This macro really ought to take a parameter,
  76.  * but we do it the disgusting crufty way forced on us by the ()-less
  77.  * definition of BEGIN.
  78.  */
  79. #define BEGIN yy_start = 1 + 2 *
  80.  
  81. /* Translate the current start state into a value that can be later handed
  82.  * to BEGIN to return to the state.
  83.  */
  84. #define YY_START ((yy_start - 1) / 2)
  85.  
  86. /* Action number for EOF rule of a given start state. */
  87. #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
  88.  
  89. /* Special action meaning "start processing a new file".  Now included
  90.  * only for backward compatibility with previous versions of flex.
  91.  */
  92. #define YY_NEW_FILE yyrestart( yyin )
  93.  
  94. #define YY_END_OF_BUFFER_CHAR 0
  95.  
  96. /* Size of default input buffer. */
  97. #define YY_BUF_SIZE 16384
  98.  
  99. typedef struct yy_buffer_state *YY_BUFFER_STATE;
  100.  
  101. extern int yyleng;
  102. %-
  103. extern FILE *yyin, *yyout;
  104. %*
  105.  
  106. #ifdef __cplusplus
  107. extern "C" {
  108. #endif
  109.     extern int yywrap YY_PROTO(( void ));
  110. #ifdef __cplusplus
  111.     }
  112. #endif
  113.  
  114. #define EOB_ACT_CONTINUE_SCAN 0
  115. #define EOB_ACT_END_OF_FILE 1
  116. #define EOB_ACT_LAST_MATCH 2
  117.  
  118. /* The funky do-while in the following #define is used to turn the definition
  119.  * int a single C statement (which needs a semi-colon terminator).  This
  120.  * avoids problems with code like:
  121.  *
  122.  *     if ( condition_holds )
  123.  *        yyless( 5 );
  124.  *    else
  125.  *        do_something_else();
  126.  *
  127.  * Prior to using the do-while the compiler would get upset at the
  128.  * "else" because it interpreted the "if" statement as being all
  129.  * done when it reached the ';' after the yyless() call.
  130.  */
  131.  
  132. /* Return all but the first 'n' matched characters back to the input stream. */
  133.  
  134. #define yyless(n) \
  135.     do \
  136.         { \
  137.         /* Undo effects of setting up yytext. */ \
  138.         *yy_cp = yy_hold_char; \
  139.         yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
  140.         YY_DO_BEFORE_ACTION; /* set up yytext again */ \
  141.         } \
  142.     while ( 0 )
  143.  
  144. #define unput(c) yyunput( c, yytext_ptr )
  145.  
  146.  
  147. struct yy_buffer_state
  148.     {
  149. %-
  150.     FILE *yy_input_file;
  151. %+
  152.     istream* yy_input_file;
  153. %*
  154.  
  155.     char *yy_ch_buf;        /* input buffer */
  156.     char *yy_buf_pos;        /* current position in input buffer */
  157.  
  158.     /* Size of input buffer in bytes, not including room for EOB
  159.      * characters.
  160.      */
  161.     int yy_buf_size;
  162.  
  163.     /* Number of characters read into yy_ch_buf, not including EOB
  164.      * characters.
  165.      */
  166.     int yy_n_chars;
  167.  
  168.     /* Whether this is an "interactive" input source; if so, and
  169.      * if we're using stdio for input, then we want to use getc()
  170.      * instead of fread(), to make sure we stop fetching input after
  171.      * each newline.
  172.      */
  173.     int yy_is_interactive;
  174.  
  175.     /* Whether to try to fill the input buffer when we reach the
  176.      * end of it.
  177.      */
  178.     int yy_fill_buffer;
  179.  
  180.     int yy_buffer_status;
  181. #define YY_BUFFER_NEW 0
  182. #define YY_BUFFER_NORMAL 1
  183.     /* When an EOF's been seen but there's still some text to process
  184.      * then we mark the buffer as YY_EOF_PENDING, to indicate that we
  185.      * shouldn't try reading from the input source any more.  We might
  186.      * still have a bunch of tokens to match, though, because of
  187.      * possible backing-up.
  188.      *
  189.      * When we actually see the EOF, we change the status to "new"
  190.      * (via yyrestart()), so that the user can continue scanning by
  191.      * just pointing yyin at a new input file.
  192.      */
  193. #define YY_BUFFER_EOF_PENDING 2
  194.     };
  195.  
  196. %- Standard (non-C++) definition
  197. static YY_BUFFER_STATE yy_current_buffer = 0;
  198. %*
  199.  
  200. /* We provide macros for accessing buffer states in case in the
  201.  * future we want to put the buffer states in a more general
  202.  * "scanner state".
  203.  */
  204. #define YY_CURRENT_BUFFER yy_current_buffer
  205.  
  206.  
  207. %- Standard (non-C++) definition
  208. /* yy_hold_char holds the character lost when yytext is formed. */
  209. static char yy_hold_char;
  210.  
  211. static int yy_n_chars;        /* number of characters read into yy_ch_buf */
  212.  
  213.  
  214. int yyleng;
  215.  
  216. /* Points to current character in buffer. */
  217. static char *yy_c_buf_p = (char *) 0;
  218. static int yy_init = 1;        /* whether we need to initialize */
  219. static int yy_start = 0;    /* start state number */
  220.  
  221. /* Flag which is used to allow yywrap()'s to do buffer switches
  222.  * instead of setting up a fresh yyin.  A bit of a hack ...
  223.  */
  224. static int yy_did_buffer_switch_on_eof;
  225.  
  226. static void yyunput YY_PROTO(( int c, char *buf_ptr ));
  227. void yyrestart YY_PROTO(( FILE *input_file ));
  228. void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
  229. void yy_load_buffer_state YY_PROTO(( void ));
  230. YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
  231. void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
  232. void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
  233.  
  234. static int yy_start_stack_ptr = 0;
  235. static int yy_start_stack_depth = 0;
  236. static int *yy_start_stack = 0;
  237. static void yy_push_state YY_PROTO(( int new_state ));
  238. static void yy_pop_state YY_PROTO(( void ));
  239. static int yy_top_state YY_PROTO(( void ));
  240. %*
  241.  
  242. static void *yy_flex_alloc YY_PROTO(( unsigned int ));
  243. static void *yy_flex_realloc YY_PROTO(( void *, unsigned int ));
  244. static void yy_flex_free YY_PROTO(( void * ));
  245.  
  246. #define yy_new_buffer yy_create_buffer
  247.  
  248. %% yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here
  249.  
  250. #ifndef yytext_ptr
  251. static void yy_flex_strncpy YY_PROTO(( char *, const char *, int ));
  252. #endif
  253.  
  254. %- Standard (non-C++) definition
  255. #ifdef __cplusplus
  256. static int yyinput YY_PROTO(( void ));
  257. #else
  258. static int input YY_PROTO(( void ));
  259. #endif
  260. %*
  261.  
  262. %- Standard (non-C++) definition
  263. static yy_state_type yy_get_previous_state YY_PROTO(( void ));
  264. static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
  265. static int yy_get_next_buffer YY_PROTO(( void ));
  266. static void yy_fatal_error YY_PROTO(( const char msg[] ));
  267. %*
  268.  
  269. /* Done after the current pattern has been matched and before the
  270.  * corresponding action - sets up yytext.
  271.  */
  272. #define YY_DO_BEFORE_ACTION \
  273.     yytext_ptr = yy_bp; \
  274. %% code to fiddle yytext and yyleng for yymore() goes here
  275.     yy_hold_char = *yy_cp; \
  276.     *yy_cp = '\0'; \
  277. %% code to copy yytext_ptr to yytext[] goes here, if %array
  278.     yy_c_buf_p = yy_cp;
  279.  
  280. %% data tables for the DFA and the user's section 1 definitions go here
  281.  
  282. /* Macros after this point can all be overridden by user definitions in
  283.  * section 1.
  284.  */
  285.  
  286. #ifdef YY_MALLOC_DECL
  287. YY_MALLOC_DECL
  288. #else
  289. #if __STDC__
  290. #ifndef __cplusplus
  291. #include <stdlib.h>
  292. #endif
  293. #else
  294. /* Just try to get by without declaring the routines.  This will fail
  295.  * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
  296.  * or sizeof(void*) != sizeof(int).
  297.  */
  298. #endif
  299. #endif
  300.  
  301. /* Amount of stuff to slurp up with each read. */
  302. #ifndef YY_READ_BUF_SIZE
  303. #define YY_READ_BUF_SIZE 8192
  304. #endif
  305.  
  306. /* Copy whatever the last rule matched to the standard output. */
  307.  
  308. #ifndef ECHO
  309. %- Standard (non-C++) definition
  310. /* This used to be an fputs(), but since the string might contain NUL's,
  311.  * we now use fwrite().
  312.  */
  313. #define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
  314. %+ C++ definition
  315. #define ECHO LexerOutput( yytext, yyleng )
  316. %*
  317. #endif
  318.  
  319. /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
  320.  * is returned in "result".
  321.  */
  322. #ifndef YY_INPUT
  323. #define YY_INPUT(buf,result,max_size) \
  324. %% fread()/read() definition of YY_INPUT goes here unless we're doing C++
  325. %+ C++ definition
  326.     if ( (result = LexerInput( (char *) buf, max_size )) < 0 ) \
  327.         YY_FATAL_ERROR( "input in flex scanner failed" );
  328. %*
  329. #endif
  330.  
  331. /* No semi-colon after return; correct usage is to write "yyterminate();" -
  332.  * we don't want an extra ';' after the "return" because that will cause
  333.  * some compilers to complain about unreachable statements.
  334.  */
  335. #ifndef yyterminate
  336. #define yyterminate() return YY_NULL
  337. #endif
  338.  
  339. /* Number of entries by which start-condition stack grows. */
  340. #ifndef YY_START_STACK_INCR
  341. #define YY_START_STACK_INCR 25
  342. #endif
  343.  
  344. /* Report a fatal error. */
  345. #ifndef YY_FATAL_ERROR
  346. %-
  347. #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
  348. %+
  349. #define YY_FATAL_ERROR(msg) LexerError( msg )
  350. %*
  351. #endif
  352.  
  353. /* Default declaration of generated scanner - a define so the user can
  354.  * easily add parameters.
  355.  */
  356. #ifndef YY_DECL
  357. %- Standard (non-C++) definition
  358. #define YY_DECL int yylex YY_PROTO(( void ))
  359. %+ C++ definition
  360. #define YY_DECL int yyFlexLexer::yylex()
  361. %*
  362. #endif
  363.  
  364. /* Code executed at the beginning of each rule, after yytext and yyleng
  365.  * have been set up.
  366.  */
  367. #ifndef YY_USER_ACTION
  368. #define YY_USER_ACTION
  369. #endif
  370.  
  371. /* Code executed at the end of each rule. */
  372. #ifndef YY_BREAK
  373. #define YY_BREAK break;
  374. #endif
  375.  
  376. YY_DECL
  377.     {
  378.     register yy_state_type yy_current_state;
  379.     register char *yy_cp, *yy_bp;
  380.     register int yy_act;
  381.  
  382. %% user's declarations go here
  383.  
  384.     if ( yy_init )
  385.         {
  386. #ifdef YY_USER_INIT
  387.         YY_USER_INIT;
  388. #endif
  389.  
  390.         if ( ! yy_start )
  391.             yy_start = 1;    /* first start state */
  392.  
  393.         if ( ! yyin )
  394. %-
  395.             yyin = stdin;
  396. %+
  397.             yyin = &cin;
  398. %*
  399.  
  400.         if ( ! yyout )
  401. %-
  402.             yyout = stdout;
  403. %+
  404.             yyout = &cout;
  405. %*
  406.  
  407.         if ( yy_current_buffer )
  408.             yy_init_buffer( yy_current_buffer, yyin );
  409.         else
  410.             yy_current_buffer =
  411.                 yy_create_buffer( yyin, YY_BUF_SIZE );
  412.  
  413.         yy_load_buffer_state();
  414.  
  415.         yy_init = 0;
  416.         }
  417.  
  418.     while ( 1 )        /* loops until end-of-file is reached */
  419.         {
  420. %% yymore()-related code goes here
  421.         yy_cp = yy_c_buf_p;
  422.  
  423.         /* Support of yytext. */
  424.         *yy_cp = yy_hold_char;
  425.  
  426.         /* yy_bp points to the position in yy_ch_buf of the start of
  427.          * the current run.
  428.          */
  429.         yy_bp = yy_cp;
  430.  
  431. %% code to set up and find next match goes here
  432.  
  433. yy_find_action:
  434. %% code to find the action number goes here
  435.  
  436.         YY_DO_BEFORE_ACTION;
  437.  
  438. %% code for yylineno update goes here, if -l option
  439.  
  440. do_action:    /* This label is used only to access EOF actions. */
  441.  
  442. %% debug code goes here
  443.  
  444.         switch ( yy_act )
  445.     { /* beginning of action switch */
  446. %% actions go here
  447.  
  448.     case YY_END_OF_BUFFER:
  449.         {
  450.         /* Amount of text matched not including the EOB char. */
  451.         int yy_amount_of_matched_text = yy_cp - yytext_ptr - 1;
  452.  
  453.         /* Undo the effects of YY_DO_BEFORE_ACTION. */
  454.         *yy_cp = yy_hold_char;
  455.  
  456.         if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
  457.             {
  458.             /* We're scanning a new file or input source.  It's
  459.              * possible that this happened because the user
  460.              * just pointed yyin at a new source and called
  461.              * yylex().  If so, then we have to assure
  462.              * consistency between yy_current_buffer and our
  463.              * globals.  Here is the right place to do so, because
  464.              * this is the first action (other than possibly a
  465.              * back-up) that will match for the new input source.
  466.              */
  467.             yy_n_chars = yy_current_buffer->yy_n_chars;
  468.             yy_current_buffer->yy_input_file = yyin;
  469.             yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
  470.             }
  471.  
  472.         /* Note that here we test for yy_c_buf_p "<=" to the position
  473.          * of the first EOB in the buffer, since yy_c_buf_p will
  474.          * already have been incremented past the NUL character
  475.          * (since all states make transitions on EOB to the
  476.          * end-of-buffer state).  Contrast this with the test
  477.          * in input().
  478.          */
  479.         if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
  480.             { /* This was really a NUL. */
  481.             yy_state_type yy_next_state;
  482.  
  483.             yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
  484.  
  485.             yy_current_state = yy_get_previous_state();
  486.  
  487.             /* Okay, we're now positioned to make the NUL
  488.              * transition.  We couldn't have
  489.              * yy_get_previous_state() go ahead and do it
  490.              * for us because it doesn't know how to deal
  491.              * with the possibility of jamming (and we don't
  492.              * want to build jamming into it because then it
  493.              * will run more slowly).
  494.              */
  495.  
  496.             yy_next_state = yy_try_NUL_trans( yy_current_state );
  497.  
  498.             yy_bp = yytext_ptr + YY_MORE_ADJ;
  499.  
  500.             if ( yy_next_state )
  501.                 {
  502.                 /* Consume the NUL. */
  503.                 yy_cp = ++yy_c_buf_p;
  504.                 yy_current_state = yy_next_state;
  505.                 goto yy_match;
  506.                 }
  507.  
  508.             else
  509.                 {
  510. %% code to do back-up for compressed tables and set up yy_cp goes here
  511.                 goto yy_find_action;
  512.                 }
  513.             }
  514.  
  515.         else switch ( yy_get_next_buffer() )
  516.             {
  517.             case EOB_ACT_END_OF_FILE:
  518.                 {
  519.                 yy_did_buffer_switch_on_eof = 0;
  520.  
  521.                 if ( yywrap() )
  522.                     {
  523.                     /* Note: because we've taken care in
  524.                      * yy_get_next_buffer() to have set up
  525.                      * yytext, we can now set up
  526.                      * yy_c_buf_p so that if some total
  527.                      * hoser (like flex itself) wants to
  528.                      * call the scanner after we return the
  529.                      * YY_NULL, it'll still work - another
  530.                      * YY_NULL will get returned.
  531.                      */
  532.                     yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
  533.  
  534.                     yy_act = YY_STATE_EOF(YY_START);
  535.                     goto do_action;
  536.                     }
  537.  
  538.                 else
  539.                     {
  540.                     if ( ! yy_did_buffer_switch_on_eof )
  541.                         YY_NEW_FILE;
  542.                     }
  543.                 break;
  544.                 }
  545.  
  546.             case EOB_ACT_CONTINUE_SCAN:
  547.                 yy_c_buf_p =
  548.                     yytext_ptr + yy_amount_of_matched_text;
  549.  
  550.                 yy_current_state = yy_get_previous_state();
  551.  
  552.                 yy_cp = yy_c_buf_p;
  553.                 yy_bp = yytext_ptr + YY_MORE_ADJ;
  554.                 goto yy_match;
  555.  
  556.             case EOB_ACT_LAST_MATCH:
  557.                 yy_c_buf_p =
  558.                 &yy_current_buffer->yy_ch_buf[yy_n_chars];
  559.  
  560.                 yy_current_state = yy_get_previous_state();
  561.  
  562.                 yy_cp = yy_c_buf_p;
  563.                 yy_bp = yytext_ptr + YY_MORE_ADJ;
  564.                 goto yy_find_action;
  565.             }
  566.         break;
  567.         }
  568.  
  569.     default:
  570.         YY_FATAL_ERROR(
  571.             "fatal flex scanner internal error--no action found" );
  572.     } /* end of action switch */
  573.         } /* end of scanning one token */
  574.     } /* end of yylex */
  575.  
  576. %+
  577. #ifdef YY_INTERACTIVE
  578. int yyFlexLexer::LexerInput( char* buf, int /* max_size */ )
  579. #else
  580. int yyFlexLexer::LexerInput( char* buf, int max_size )
  581. #endif
  582.     {
  583.     if ( yyin->eof() || yyin->fail() )
  584.         return 0;
  585.  
  586. #ifdef YY_INTERACTIVE
  587.     yyin->get( buf[0] );
  588.  
  589.     if ( yyin->eof() )
  590.         return 0;
  591.  
  592.     if ( yyin->bad() )
  593.         return -1;
  594.  
  595.     return 1;
  596.  
  597. #else
  598.     (void) yyin->read( buf, max_size );
  599.  
  600.     if ( yyin->bad() )
  601.         return -1;
  602.     else
  603.         return yyin->gcount();
  604. #endif
  605.     }
  606.  
  607. void yyFlexLexer::LexerOutput( const char* buf, int size )
  608.     {
  609.     (void) yyout->write( buf, size );
  610.     }
  611. %*
  612.  
  613. /* yy_get_next_buffer - try to read in a new buffer
  614.  *
  615.  * Returns a code representing an action:
  616.  *    EOB_ACT_LAST_MATCH -
  617.  *    EOB_ACT_CONTINUE_SCAN - continue scanning from current position
  618.  *    EOB_ACT_END_OF_FILE - end of file
  619.  */
  620.  
  621. %-
  622. static int yy_get_next_buffer()
  623. %+
  624. int yyFlexLexer::yy_get_next_buffer()
  625. %*
  626.     {
  627.     register char *dest = yy_current_buffer->yy_ch_buf;
  628.     register char *source = yytext_ptr - 1; /* copy prev. char, too */
  629.     register int number_to_move, i;
  630.     int ret_val;
  631.  
  632.     if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
  633.         YY_FATAL_ERROR(
  634.         "fatal flex scanner internal error--end of buffer missed" );
  635.  
  636.     if ( yy_current_buffer->yy_fill_buffer == 0 )
  637.         { /* Don't try to fill the buffer, so this is an EOF. */
  638.         if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
  639.             {
  640.             /* We matched a singled characater, the EOB, so
  641.              * treat this as a final EOF.
  642.              */
  643.             return EOB_ACT_END_OF_FILE;
  644.             }
  645.  
  646.         else
  647.             {
  648.             /* We matched some text prior to the EOB, first
  649.              * process it.
  650.              */
  651.             return EOB_ACT_LAST_MATCH;
  652.             }
  653.         }
  654.  
  655.     /* Try to read more data. */
  656.  
  657.     /* First move last chars to start of buffer. */
  658.     number_to_move = yy_c_buf_p - yytext_ptr;
  659.  
  660.     for ( i = 0; i < number_to_move; ++i )
  661.         *(dest++) = *(source++);
  662.  
  663.     if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
  664.         /* don't do the read, it's not guaranteed to return an EOF,
  665.          * just force an EOF
  666.          */
  667.         yy_n_chars = 0;
  668.  
  669.     else
  670.         {
  671.         int num_to_read =
  672.             yy_current_buffer->yy_buf_size - number_to_move - 1;
  673.  
  674.         while ( num_to_read <= 0 )
  675.             { /* Not enough room in the buffer - grow it. */
  676. #ifdef YY_USES_REJECT
  677.             YY_FATAL_ERROR(
  678. "input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
  679. #else
  680.  
  681.             /* just a shorter name for the current buffer */
  682.             YY_BUFFER_STATE b = yy_current_buffer;
  683.  
  684.             int yy_c_buf_p_offset = yy_c_buf_p - b->yy_ch_buf;
  685.  
  686.             b->yy_buf_size *= 2;
  687.             b->yy_ch_buf = (char *)
  688.                 yy_flex_realloc( (void *) b->yy_ch_buf,
  689.                          b->yy_buf_size );
  690.  
  691.             if ( ! b->yy_ch_buf )
  692.                 YY_FATAL_ERROR(
  693.                 "fatal error - scanner input buffer overflow" );
  694.  
  695.             yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
  696.  
  697.             num_to_read = yy_current_buffer->yy_buf_size -
  698.                         number_to_move - 1;
  699. #endif
  700.             }
  701.  
  702.         if ( num_to_read > YY_READ_BUF_SIZE )
  703.             num_to_read = YY_READ_BUF_SIZE;
  704.  
  705.         /* Read in more data. */
  706.         YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
  707.             yy_n_chars, num_to_read );
  708.         }
  709.  
  710.     if ( yy_n_chars == 0 )
  711.         {
  712.         if ( number_to_move - YY_MORE_ADJ == 1 )
  713.             {
  714.             ret_val = EOB_ACT_END_OF_FILE;
  715.             yyrestart( yyin );
  716.             }
  717.  
  718.         else
  719.             {
  720.             ret_val = EOB_ACT_LAST_MATCH;
  721.             yy_current_buffer->yy_buffer_status =
  722.                 YY_BUFFER_EOF_PENDING;
  723.             }
  724.         }
  725.  
  726.     else
  727.         ret_val = EOB_ACT_CONTINUE_SCAN;
  728.  
  729.     yy_n_chars += number_to_move;
  730.     yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
  731.     yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
  732.  
  733.     /* yytext begins at the second character in yy_ch_buf; the first
  734.      * character is the one which preceded it before reading in the latest
  735.      * buffer; it needs to be kept around in case it's a newline, so
  736.      * yy_get_previous_state() will have with '^' rules active.
  737.      */
  738.  
  739.     yytext_ptr = &yy_current_buffer->yy_ch_buf[1];
  740.  
  741.     return ret_val;
  742.     }
  743.  
  744.  
  745. /* yy_get_previous_state - get the state just before the EOB char was reached */
  746.  
  747. %-
  748. static yy_state_type yy_get_previous_state()
  749. %+
  750. yy_state_type yyFlexLexer::yy_get_previous_state()
  751. %*
  752.     {
  753.     register yy_state_type yy_current_state;
  754.     register char *yy_cp;
  755.  
  756. %% code to get the start state into yy_current_state goes here
  757.  
  758.     for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
  759.         {
  760. %% code to find the next state goes here
  761.         }
  762.  
  763.     return yy_current_state;
  764.     }
  765.  
  766.  
  767. /* yy_try_NUL_trans - try to make a transition on the NUL character
  768.  *
  769.  * synopsis
  770.  *    next_state = yy_try_NUL_trans( current_state );
  771.  */
  772.  
  773. %-
  774. #ifdef YY_USE_PROTOS
  775. static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
  776. #else
  777. static yy_state_type yy_try_NUL_trans( yy_current_state )
  778. yy_state_type yy_current_state;
  779. #endif
  780. %+
  781. yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state )
  782. %*
  783.     {
  784.     register int yy_is_jam;
  785. %% code to find the next state, and perhaps do backing up, goes here
  786.  
  787.     return yy_is_jam ? 0 : yy_current_state;
  788.     }
  789.  
  790.  
  791. %-
  792. #ifdef YY_USE_PROTOS
  793. static void yyunput( int c, register char *yy_bp )
  794. #else
  795. static void yyunput( c, yy_bp )
  796. int c;
  797. register char *yy_bp;
  798. #endif
  799. %+
  800. void yyFlexLexer::yyunput( int c, register char* yy_bp )
  801. %*
  802.     {
  803.     register char *yy_cp = yy_c_buf_p;
  804.  
  805.     /* undo effects of setting up yytext */
  806.     *yy_cp = yy_hold_char;
  807.  
  808.     if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
  809.         { /* need to shift things up to make room */
  810.         /* +2 for EOB chars. */
  811.         register int number_to_move = yy_n_chars + 2;
  812.         register char *dest = &yy_current_buffer->yy_ch_buf[
  813.                     yy_current_buffer->yy_buf_size + 2];
  814.         register char *source =
  815.                 &yy_current_buffer->yy_ch_buf[number_to_move];
  816.  
  817.         while ( source > yy_current_buffer->yy_ch_buf )
  818.             *--dest = *--source;
  819.  
  820.         yy_cp += dest - source;
  821.         yy_bp += dest - source;
  822.         yy_n_chars = yy_current_buffer->yy_buf_size;
  823.  
  824.         if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
  825.             YY_FATAL_ERROR( "flex scanner push-back overflow" );
  826.         }
  827.  
  828.     if ( yy_cp > yy_bp && yy_cp[-1] == '\n' )
  829.         yy_cp[-2] = '\n';
  830.  
  831.     *--yy_cp = (char) c;
  832.  
  833. %% update yylineno here, if doing -l
  834.  
  835.     /* Note: the formal parameter *must* be called "yy_bp" for this
  836.      * macro to now work correctly.
  837.      */
  838.     YY_DO_BEFORE_ACTION; /* set up yytext again */
  839.     }
  840.  
  841.  
  842. %-
  843. #ifdef __cplusplus
  844. static int yyinput()
  845. #else
  846. static int input()
  847. #endif
  848. %+
  849. int yyFlexLexer::yyinput()
  850. %*
  851.     {
  852.     int c;
  853.  
  854.     *yy_c_buf_p = yy_hold_char;
  855.  
  856.     if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
  857.         {
  858.         /* yy_c_buf_p now points to the character we want to return.
  859.          * If this occurs *before* the EOB characters, then it's a
  860.          * valid NUL; if not, then we've hit the end of the buffer.
  861.          */
  862.         if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
  863.             /* This was really a NUL. */
  864.             *yy_c_buf_p = '\0';
  865.  
  866.         else
  867.             { /* need more input */
  868.             yytext_ptr = yy_c_buf_p;
  869.             ++yy_c_buf_p;
  870.  
  871.             switch ( yy_get_next_buffer() )
  872.                 {
  873.                 case EOB_ACT_END_OF_FILE:
  874.                     {
  875.                     if ( yywrap() )
  876.                         {
  877.                         yy_c_buf_p =
  878.                         yytext_ptr + YY_MORE_ADJ;
  879.                         return EOF;
  880.                         }
  881.  
  882.                     YY_NEW_FILE;
  883. #ifdef __cplusplus
  884.                     return yyinput();
  885. #else
  886.                     return input();
  887. #endif
  888.                     }
  889.  
  890.                 case EOB_ACT_CONTINUE_SCAN:
  891.                     yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
  892.                     break;
  893.  
  894.                 case EOB_ACT_LAST_MATCH:
  895. #ifdef __cplusplus
  896.                     YY_FATAL_ERROR(
  897.                     "unexpected last match in yyinput()" );
  898. #else
  899.                     YY_FATAL_ERROR(
  900.                     "unexpected last match in input()" );
  901. #endif
  902.                 }
  903.             }
  904.         }
  905.  
  906.     c = *(unsigned char *) yy_c_buf_p;    /* cast for 8-bit char's */
  907.     *yy_c_buf_p = '\0';    /* preserve yytext */
  908.     yy_hold_char = *++yy_c_buf_p;
  909.  
  910.     return c;
  911.     }
  912.  
  913.  
  914. %-
  915. #ifdef YY_USE_PROTOS
  916. void yyrestart( FILE *input_file )
  917. #else
  918. void yyrestart( input_file )
  919. FILE *input_file;
  920. #endif
  921. %+
  922. void yyFlexLexer::yyrestart( istream* input_file )
  923. %*
  924.     {
  925.     if ( ! yy_current_buffer )
  926.         yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
  927.  
  928.     yy_init_buffer( yy_current_buffer, input_file );
  929.     yy_load_buffer_state();
  930.     }
  931.  
  932.  
  933. %-
  934. #ifdef YY_USE_PROTOS
  935. void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
  936. #else
  937. void yy_switch_to_buffer( new_buffer )
  938. YY_BUFFER_STATE new_buffer;
  939. #endif
  940. %+
  941. void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
  942. %*
  943.     {
  944.     if ( yy_current_buffer == new_buffer )
  945.         return;
  946.  
  947.     if ( yy_current_buffer )
  948.         {
  949.         /* Flush out information for old buffer. */
  950.         *yy_c_buf_p = yy_hold_char;
  951.         yy_current_buffer->yy_buf_pos = yy_c_buf_p;
  952.         yy_current_buffer->yy_n_chars = yy_n_chars;
  953.         }
  954.  
  955.     yy_current_buffer = new_buffer;
  956.     yy_load_buffer_state();
  957.  
  958.     /* We don't actually know whether we did this switch during
  959.      * EOF (yywrap()) processing, but the only time this flag
  960.      * is looked at is after yywrap() is called, so it's safe
  961.      * to go ahead and always set it.
  962.      */
  963.     yy_did_buffer_switch_on_eof = 1;
  964.     }
  965.  
  966.  
  967. %-
  968. #ifdef YY_USE_PROTOS
  969. void yy_load_buffer_state( void )
  970. #else
  971. void yy_load_buffer_state()
  972. #endif
  973. %+
  974. void yyFlexLexer::yy_load_buffer_state()
  975. %*
  976.     {
  977.     yy_n_chars = yy_current_buffer->yy_n_chars;
  978.     yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
  979.     yyin = yy_current_buffer->yy_input_file;
  980.     yy_hold_char = *yy_c_buf_p;
  981.     }
  982.  
  983.  
  984. %-
  985. #ifdef YY_USE_PROTOS
  986. YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
  987. #else
  988. YY_BUFFER_STATE yy_create_buffer( file, size )
  989. FILE *file;
  990. int size;
  991. #endif
  992. %+
  993. YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( istream* file, int size )
  994. %*
  995.     {
  996.     YY_BUFFER_STATE b;
  997.  
  998.     b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
  999.  
  1000.     if ( ! b )
  1001.         YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
  1002.  
  1003.     b->yy_buf_size = size;
  1004.  
  1005.     /* yy_ch_buf has to be 2 characters longer than the size given because
  1006.      * we need to put in 2 end-of-buffer characters.
  1007.      */
  1008.     b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
  1009.  
  1010.     if ( ! b->yy_ch_buf )
  1011.         YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
  1012.  
  1013.     yy_init_buffer( b, file );
  1014.  
  1015.     return b;
  1016.     }
  1017.  
  1018.  
  1019. %-
  1020. #ifdef YY_USE_PROTOS
  1021. void yy_delete_buffer( YY_BUFFER_STATE b )
  1022. #else
  1023. void yy_delete_buffer( b )
  1024. YY_BUFFER_STATE b;
  1025. #endif
  1026. %+
  1027. void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b )
  1028. %*
  1029.     {
  1030.     if ( b == yy_current_buffer )
  1031.         yy_current_buffer = (YY_BUFFER_STATE) 0;
  1032.  
  1033.     yy_flex_free( (void *) b->yy_ch_buf );
  1034.     yy_flex_free( (void *) b );
  1035.     }
  1036.  
  1037.  
  1038. %-
  1039. #ifdef YY_USE_PROTOS
  1040. void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
  1041. #else
  1042. void yy_init_buffer( b, file )
  1043. YY_BUFFER_STATE b;
  1044. FILE *file;
  1045. #endif
  1046. %+
  1047. void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, istream* file )
  1048. %*
  1049.     {
  1050.     b->yy_input_file = file;
  1051.  
  1052.     /* We put in the '\n' and start reading from [1] so that an
  1053.      * initial match-at-newline will be true.
  1054.      */
  1055.  
  1056.     b->yy_ch_buf[0] = '\n';
  1057.     b->yy_n_chars = 1;
  1058.  
  1059.     /* We always need two end-of-buffer characters.  The first causes
  1060.      * a transition to the end-of-buffer state.  The second causes
  1061.      * a jam in that state.
  1062.      */
  1063.     b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
  1064.     b->yy_ch_buf[2] = YY_END_OF_BUFFER_CHAR;
  1065.  
  1066.     b->yy_buf_pos = &b->yy_ch_buf[1];
  1067.  
  1068. %-
  1069.     b->yy_is_interactive = file ? isatty( fileno(file) ) : 0;
  1070. %+
  1071.     b->yy_is_interactive = 0;
  1072. %*
  1073.  
  1074.     b->yy_fill_buffer = 1;
  1075.  
  1076.     b->yy_buffer_status = YY_BUFFER_NEW;
  1077.     }
  1078.  
  1079.  
  1080. %-
  1081. #ifdef YY_USE_PROTOS
  1082. static void yy_push_state( int new_state )
  1083. #else
  1084. static void yy_push_state( new_state )
  1085. int new_state;
  1086. #endif
  1087. %+
  1088. void yyFlexLexer::yy_push_state( int new_state )
  1089. %*
  1090.     {
  1091.     if ( yy_start_stack_ptr >= yy_start_stack_depth )
  1092.         {
  1093.         int new_size;
  1094.  
  1095.         yy_start_stack_depth += YY_START_STACK_INCR;
  1096.         new_size = yy_start_stack_depth * sizeof( int );
  1097.  
  1098.         if ( ! yy_start_stack )
  1099.             yy_start_stack = (int *) yy_flex_alloc( new_size );
  1100.  
  1101.         else
  1102.             yy_start_stack = (int *) yy_flex_realloc(
  1103.                     (void *) yy_start_stack, new_size );
  1104.  
  1105.         if ( ! yy_start_stack )
  1106.             YY_FATAL_ERROR(
  1107.             "out of memory expanding start-condition stack" );
  1108.         }
  1109.  
  1110.     yy_start_stack[yy_start_stack_ptr++] = YY_START;
  1111.  
  1112.     BEGIN(new_state);
  1113.     }
  1114.  
  1115.  
  1116. %-
  1117. static void yy_pop_state()
  1118. %+
  1119. void yyFlexLexer::yy_pop_state()
  1120. %*
  1121.     {
  1122.     if ( --yy_start_stack_ptr < 0 )
  1123.         YY_FATAL_ERROR( "start-condition stack underflow" );
  1124.  
  1125.     BEGIN(yy_start_stack[yy_start_stack_ptr]);
  1126.     }
  1127.  
  1128.  
  1129. %-
  1130. static int yy_top_state()
  1131. %+
  1132. int yyFlexLexer::yy_top_state()
  1133. %*
  1134.     {
  1135.     return yy_start_stack[yy_start_stack_ptr - 1];
  1136.     }
  1137.  
  1138.  
  1139. %-
  1140. #ifdef YY_USE_PROTOS
  1141. static void yy_fatal_error( const char msg[] )
  1142. #else
  1143. static void yy_fatal_error( msg )
  1144. char msg[];
  1145. #endif
  1146.     {
  1147.     (void) fprintf( stderr, "%s\n", msg );
  1148.     exit( 1 );
  1149.     }
  1150.  
  1151. %+
  1152.  
  1153. void yyFlexLexer::LexerError( const char msg[] )
  1154.     {
  1155.     cerr << msg << '\n';
  1156.     exit( 1 );
  1157.     }
  1158. %*
  1159.  
  1160.  
  1161. /* Redefine yyless() so it works in section 3 code. */
  1162.  
  1163. #undef yyless
  1164. #define yyless(n) \
  1165.     do \
  1166.         { \
  1167.         /* Undo effects of setting up yytext. */ \
  1168.         yytext[yyleng] = yy_hold_char; \
  1169.         yy_c_buf_p = yytext + n - YY_MORE_ADJ; \
  1170.         yy_hold_char = *yy_c_buf_p; \
  1171.         *yy_c_buf_p = '\0'; \
  1172.         yyleng = n; \
  1173.         } \
  1174.     while ( 0 )
  1175.  
  1176.  
  1177. /* Internal utility routines. */
  1178.  
  1179. #ifndef yytext_ptr
  1180. #ifdef YY_USE_PROTOS
  1181. static void yy_flex_strncpy( char *s1, const char *s2, int n )
  1182. #else
  1183. static void yy_flex_strncpy( s1, s2, n )
  1184. char *s1;
  1185. const char *s2;
  1186. int n;
  1187. #endif
  1188.     {
  1189.     register int i;
  1190.     for ( i = 0; i < n; ++i )
  1191.         s1[i] = s2[i];
  1192.     }
  1193. #endif
  1194.  
  1195.  
  1196. #ifdef YY_USE_PROTOS
  1197. static void *yy_flex_alloc( unsigned int size )
  1198. #else
  1199. static void *yy_flex_alloc( size )
  1200. unsigned int size;
  1201. #endif
  1202.     {
  1203.     return (void *) malloc( size );
  1204.     }
  1205.  
  1206. #ifdef YY_USE_PROTOS
  1207. static void *yy_flex_realloc( void *ptr, unsigned int size )
  1208. #else
  1209. static void *yy_flex_realloc( ptr, size )
  1210. void *ptr;
  1211. unsigned int size;
  1212. #endif
  1213.     {
  1214.     return (void *) realloc( ptr, size );
  1215.     }
  1216.  
  1217. #ifdef YY_USE_PROTOS
  1218. static void yy_flex_free( void *ptr )
  1219. #else
  1220. static void yy_flex_free( ptr )
  1221. void *ptr;
  1222. #endif
  1223.     {
  1224.     free( ptr );
  1225.     }
  1226.